Script to create one to many links?

A number of months ago i found a script in this forum that allows me to create links between one object in Module B to many objects in Module A, by matching an attribute in a Module A to comma separated list in an attribute in Module B. For example:
Module A has Objects:
ID TextAttrA
AOBJ_1 DI_AAA
AOBJ_2 DI_AAB

In Module B i would have
ID ObjectText TextAttrB
BOBJ_1 VER1 DI_AAA,DI_AAB,DI_AAC

The script would create links from Module B to Module A, in this case:
BOBJ_1 --> AOBJ_1
BOBJ_1 --> AOBJ_2

I simply cannot find it now! Any one know of this script?
Proutsy - Tue Jun 07 09:54:20 EDT 2011

Re: Script to create one to many links?
llandale - Tue Jun 07 13:03:23 EDT 2011

Sounds vaguely familiar.

I'm actually doing this right now and I can say without reservation that [1] this is the most complicated endevour I've ever done, or [2] I'm a complete idiot. Here are some considerations:

[] You need to specify that the Attribute in A to which other modules (B) reference is "TextAttrA". I called that the "UniqueKey" attribute for A.
[] Some modules "A" can also be referenced by their Object Identifiers.
[] Some modules "A" have almost-Unique-Key values.
[] You need to have some mechansim for reading A and retrieving a Skip list of all the UniqueKeys and the associated Objects, and a mechansim for find and reporting duplicates and otherwise illegal references.
[] You need to specify legal Delimiters for TextAttrA. Yes, the standard comma,semi-colon,space,tab, eol etc will usually work, but what happens when that attribute actually has some of those characters as part of the text?
[] You need to specify that attribute "TextAttrB" is intended to house refernces to the unique key in A. Or more generally, "TextAttrB" can reference a number of modules A1, A2, A3. e.g. attribute "InterfaceReferences" may contain desired links to any one of the 5 Interface documents, and e.g. the Test Procedures can reference any number of "RequiremetModules" objects.
[] When you see the values of TextAttrB you need to delimit them based on the sub-set of all the valid Delimiters for the various A1, A2 etc modules.
[] You need to remove links from B to A1 and A2 that are no longer being referenced. To do that you need to know ALL the modules to which that attr CAN link.
[] You should preserve without either deleting nor creating a desired link that indeed (still) exists.
[] You can close source modules when you are done but you need some fuzzy algorithms to optimize the desire to keep Target modules open rather than continually opening them when a different source wants to link to it ... with the notion of running out of memory because too many modules are open.
[] You need to have some mechanism for telling the program all the Link Relationship details that apply to this Project. Still working on that.
[] There are others, like associating which link module goes with which Link Attr.

I'm at 1300 lines now but figure to get to 1700; just for the library functions to perform these chores, not counting the existing functions that these new functions use and not counting all the additional comments that surely I will want to add.

The voice in my head says its "Number [2]" but I think I can keep that suppressed long enough to prove it.

When I'm done we will have no trouble having engineers specify their desired links in attributes and let the script manage the links.

  • Louie

Re: Script to create one to many links?
Proutsy - Tue Jun 07 13:26:45 EDT 2011

llandale - Tue Jun 07 13:03:23 EDT 2011
Sounds vaguely familiar.

I'm actually doing this right now and I can say without reservation that [1] this is the most complicated endevour I've ever done, or [2] I'm a complete idiot. Here are some considerations:

[] You need to specify that the Attribute in A to which other modules (B) reference is "TextAttrA". I called that the "UniqueKey" attribute for A.
[] Some modules "A" can also be referenced by their Object Identifiers.
[] Some modules "A" have almost-Unique-Key values.
[] You need to have some mechansim for reading A and retrieving a Skip list of all the UniqueKeys and the associated Objects, and a mechansim for find and reporting duplicates and otherwise illegal references.
[] You need to specify legal Delimiters for TextAttrA. Yes, the standard comma,semi-colon,space,tab, eol etc will usually work, but what happens when that attribute actually has some of those characters as part of the text?
[] You need to specify that attribute "TextAttrB" is intended to house refernces to the unique key in A. Or more generally, "TextAttrB" can reference a number of modules A1, A2, A3. e.g. attribute "InterfaceReferences" may contain desired links to any one of the 5 Interface documents, and e.g. the Test Procedures can reference any number of "RequiremetModules" objects.
[] When you see the values of TextAttrB you need to delimit them based on the sub-set of all the valid Delimiters for the various A1, A2 etc modules.
[] You need to remove links from B to A1 and A2 that are no longer being referenced. To do that you need to know ALL the modules to which that attr CAN link.
[] You should preserve without either deleting nor creating a desired link that indeed (still) exists.
[] You can close source modules when you are done but you need some fuzzy algorithms to optimize the desire to keep Target modules open rather than continually opening them when a different source wants to link to it ... with the notion of running out of memory because too many modules are open.
[] You need to have some mechanism for telling the program all the Link Relationship details that apply to this Project. Still working on that.
[] There are others, like associating which link module goes with which Link Attr.

I'm at 1300 lines now but figure to get to 1700; just for the library functions to perform these chores, not counting the existing functions that these new functions use and not counting all the additional comments that surely I will want to add.

The voice in my head says its "Number [2]" but I think I can keep that suppressed long enough to prove it.

When I'm done we will have no trouble having engineers specify their desired links in attributes and let the script manage the links.

  • Louie

I feel your pain. I defintely downloaded the script from this forum,and it worked wonderfully, with just a few minor tweeks. I hope someone remembers it and can send it.

Re: Script to create one to many links?
SystemAdmin - Wed Jun 08 00:36:31 EDT 2011

The search functionality did not find that kind of script in a post ... but you have that functionality built-in in your DOORS client. In a module go to Tools / DXL Library, open the "Some example programs..." section and run the "Example to link DOORS Formal module according to a Foreing Key" script.

Re: Script to create one to many links?
Proutsy - Fri Jun 10 13:49:26 EDT 2011

SystemAdmin - Wed Jun 08 00:36:31 EDT 2011
The search functionality did not find that kind of script in a post ... but you have that functionality built-in in your DOORS client. In a module go to Tools / DXL Library, open the "Some example programs..." section and run the "Example to link DOORS Formal module according to a Foreing Key" script.

That example is EXACTLY what i wanted! It is better than the original i found! Thank you so much!!!!

Re: Script to create one to many links?
llandale - Fri Jun 10 16:03:27 EDT 2011

Proutsy - Fri Jun 10 13:49:26 EDT 2011
That example is EXACTLY what i wanted! It is better than the original i found! Thank you so much!!!!

So A references B_1 and B_2 and the script creates two links. Now remove reference B_1 and run it again. Is that EXACTLY what you want? What happens when B has duplicate keys in error?

  • Louie